﻿<?xml version="1.0" encoding="utf-8"?>
<configurationsets>
  <!-- 
       ConfigurationSet used for Demo purposes and Testing
       Runs through (almost) all available actions
       XML File can contain several ConfigurationSets and any combination of them can be defined using the custom MDT List ConfigurationSet.
       
       Syntax:
       <configurationsets>
           <configurationset id="">
               <operations>
                   ...
               </operations>
           </configurationset>
       </configurationsets>
  -->
  <configurationset id="Demo">
    <!-- 
         Rule(s) can be added to any level from configuration set down to individual actions. 
         Will limit execution as defined per rule. No include rule will default to all. 
         Can be any combination of include and exclude.
         
         Syntax:
         <rules>
             <include|exclude> condition="any|all">
                 <rule property="" operator="equals|startswith|endswith|contains|notcontains|empty|notempty" value="" />
                 <rule ... />
              </include|exclude>
         </rules>
    -->
    <rules>
      <include condition="any">
        <rule property="OS" operator="equals" value="Windows_NT" />
      </include>
      <exclude condition="any">
        <rule property="Username" operator="contains" value="Mustermann" />
      </exclude>
    </rules>

    <!-- 
         operations node contains the individual operations that can be executed in the order specified. 
         Values and names can contain MDT properties or environment variables
    -->
    <operations>
      <!--
           Folder operations allow to create, delete, copy, and move folders. 

           Syntax:
           <folder source="" [target=""] operation="create|delete|copy|move" [overwrite=true|false]/>                
      -->

      <folder source="%Temp%\CustomConfigurationDemo" operation="create" />
      <folder source="%Temp%\CustomConfigurationDemo\FolderCopyTest" operation="create" />
      <folder source="%Temp%\CustomConfigurationDemo\FolderCopyTest" target="%Temp%\CustomConfigurationDemo\FolderMoveTest" operation="copy" />
      <folder source="%Temp%\CustomConfigurationDemo\FolderMoveTest" target="%Temp%\CustomConfigurationDemo\FolderDeleteTest" operation="move" />
      <folder source="%Temp%\CustomConfigurationDemo\FolderDeleteTest" operation="delete" />


      <!-- 
           File operations allow to create, delete, copy, move, and update files.
           Update operation will contain more information. Demoing standard operations first.
           
           Common Syntax:
           <file source="" [target=""] operation="create|delete|copy|move|update" [type="ini|xml"]></file>
      -->
      <file source="%Temp%\CustomConfigurationDemo\FileCopyTest.txt" operation="create" />
      <file source="%Temp%\CustomConfigurationDemo\FileCopyTest.txt" target="%Temp%\CustomConfigurationDemo\FileMoveTest.txt" operation="copy" />
      <file source="%Temp%\CustomConfigurationDemo\FileMoveTest.txt" target="%Temp%\CustomConfigurationDemo\FileDeleteTest.txt" operation="move" />
      <file source="%Temp%\CustomConfigurationDemo\FileDeleteTest.txt" operation="delete" />


      <!--
           Updating ini files allows to specify sections and values to be created, updated, deleted, and read
           
           Syntax:
           <file source="" operation="update" type="ini">
               <section name="" [operation="update|delete"]>
                   <key name="" [operation="update|delete|read>value"] [property=""] [overwrite="true|false"]>value</key>
               </section>
               ...
           </file>
      -->
      <file source="%Temp%\CustomConfigurationDemo\FileIniTest.ini" operation="create" type="ini"/>
      <file source="%Temp%\CustomConfigurationDemo\FileIniTest.ini" type="ini" operation="update">
        <section name="EnvironmentVariables">
          <key name="Username">%Username%</key>
          <key name="SystemRoot">%SystemRoot%</key>
          <key name="Temp">#Left("%Temp%",5)#</key>
          <key name="Architecture">
            64 Bit
            <rules>
              <exclude condition="any">
                <rule property="ProgramFiles(x86)" operator="empty" />
              </exclude>
            </rules>
          </key>
          <key name="Architecture">
            32 Bit
            <rules>
              <exclude condition="any">
                <rule property="ProgramFiles(x86)" operator="notempty" />
              </exclude>
            </rules>
          </key>
        </section>
        <section name="DeleteSection">
          <key name="TestKey1" operation="update">TestValue</key>
          <key name="TestKey2" operation="update">TestValue2</key>
          <key name="TestKey1" operation="read" property="MDTDemoPropertyINI1" overwrite="false" />
          <key name="TestKey2" operation="read" property="MDTDemoPropertyINI2" overwrite="false" />
        </section>
      </file>
      <file source="%Temp%\CustomConfigurationDemo\FileIniTest.ini" type="ini" operation="update">
        <section name="DeleteSection" operation="delete" />
      </file>


      <!--
           Updating xml files allows to specify nodes and attributes to be created, deleted, updated, and read
           
           Syntax:
           <file source="" type="xml" operation="update">
               <node operation="create|delete|update|read" occurence="first|all" position="prepend|append|firstchild|lastchild" [property=""] [overwrite="true|false"]>
                   <xpath><![CDATA[//somexpathquery]]></xpath>
                   <value>somevalue</value>
                   <attribute name="" [operation="update|delete|read"] [property=""] [overwrite="true|false"]
               </node>
               ...
           </file>
      -->
      <file source="%Temp%\CustomConfigurationDemo\FileXMLTest.xml" operation="create" type="xml" overwrite="true">
          <DemoRoot></DemoRoot>
      </file>

      <file source="%Temp%\CustomConfigurationDemo\FileXMLTest.xml" operation="update" type="xml">
        <node operation="create">
          <xpath><![CDATA[/DemoRoot]]></xpath>
          <node>
            <Demo1>Hello World</Demo1>
            <Demo2></Demo2>
            <Demo3></Demo3>
          </node>
        </node>
        
        <node operation="delete" occurence="all">
          <xpath><![CDATA[//Demo1]]></xpath>
        </node>
        
        <node operation="update">
          <xpath><![CDATA[//Demo2]]></xpath>
          <value>110</value>
          <attribute name="operation" operation="update">Test</attribute>
          <attribute name="TestAttribute">Test2</attribute>
          <attribute name="TestAttribute2">Test3</attribute>
          <attribute name="TestAttribute2" operation="delete" />
        </node>
        
        <node operation="read">
          <xpath><![CDATA[//Demo2]]></xpath>
          <value property="MDTDemoPropertyXML1" overwrite="false"/>
          <attribute name="TestAttribute" property="MDTDemoPropertyXML2" overwrite="true" />
        </node>
        
        <node operation="update">
          <xpath><![CDATA[//Demo2]]></xpath>
          <attribute name="MDTDemoPropertyXML2">#Left("%MDTDemoPropertyXML2%",4)#</attribute>
        </node>
        
        <node operation="delete">
          <xpath><![CDATA[//Demo3]]></xpath>
        </node>
        
        <node operation="create">
          <xpath><![CDATA[//DemoRoot]]></xpath>
          <node position="child">
            <Demo3>
              <WithChild>
                <AndSome attributes="HelloWorld"></AndSome>
              </WithChild>
            </Demo3>
          </node>
          <node position="firstchild">
            <Demo1>Blablabla</Demo1>
          </node>
        </node>
      </file>


      <!--
           If neither ini or xml type is defined for update operation, a plain txt file will be assumed.
           This allows to overwrite the content or append to existing content
           
           Syntax:
           <file source="" operation="update" type="txt" [overwrite="true|false"]>
               <writeline>sometext</writeline>
           </file>
      -->

      <file source="%Temp%\CustomConfigurationDemo\FiletxtTest.txt" operation="update" type="txt" overwrite="true">
        <writeline>First Line</writeline>
        <writeline>Second Line</writeline>
      </file>

      <file source="%Temp%\CustomConfigurationDemo\FiletxtTest.txt" operation="update" type="txt" overwrite="false">
        <writeline>Third Line</writeline>
        <writeline>Current User: %Username%</writeline>
        <writeline>SystemRoot: %SystemRoot%</writeline>
      </file>

      <!--
           Registry operations allow to create, update, delete, and read registry keys and values.
           
           Syntax:
           <key path="" operation="create|update|delete|append|prepend|read" [type="REG_SZ|REG_DWORD|REG_BINARY|REG_EXPAND_SZ|REG_MULTI_SZ|REG_NONE|REG_QWORD"] [property=""] [separator=""] [overwrite=""]>value</key>
           
           It optionally allows to load a hive first.
           Syntax:
           <hive source="">
               <key path="" operation="create|update|delete|append|prepend|read" [type="REG_SZ|REG_DWORD|REG_BINARY|REG_EXPAND_SZ|REG_MULTI_SZ|REG_NONE|REG_QWORD"] [property=""] [separator=""] [overwrite=""]>value</key>
           </hive>
      -->

      <registry>
        <key path="HKCU\Software\MDT\CustomConfigurationDemo\" />
        <key path="HKCU\Software\MDT\CustomConfigurationDemo\DeleteKey\" operation="update"/>
        <key path="HKCU\Software\MDT\CustomConfigurationDemo\DeleteKey\" operation="delete"/>
        <key path="HKCU\Software\MDT\CustomConfigurationDemo\DeleteValue1" operation="update" type="REG_SZ" >DEMO2</key>
        <key path="HKCU\Software\MDT\CustomConfigurationDemo\DeleteValue1" operation="append" type="REG_SZ" >DEMO3</key>
        <key path="HKCU\Software\MDT\CustomConfigurationDemo\DeleteValue1" operation="prepend" type="REG_SZ" >DEMO1</key>
        <key path="HKCU\Software\MDT\CustomConfigurationDemo\DeleteValue1" operation="read" property="MDTDemoPropertyReg1" overwrite="true" />
        <key path="HKCU\Software\MDT\CustomConfigurationDemo\DeleteValue3" operation="update">%MDTDemoPropertyReg1%</key>
        <key path="HKCU\Software\MDT\CustomConfigurationDemo\DeleteValue2" type="REG_DWORD" >2</key>
        <key path="HKCU\Software\MDT\CustomConfigurationDemo\DeleteValue1" operation="delete" />
        <key path="HKCU\Software\MDT\CustomConfigurationDemo\DeleteValue2" operation="delete" />
        <key path="HKCU\Software\MDT\CustomConfigurationDemo\DeleteValue3" operation="delete" />

        <!--<hive source="C:\Test\UsrClass.dat">
          <key path="Software\MyTestSoftware\"/>
          <key path="Software\MyTestSoftware\TestSubKey\"></key>
          <key path="Software\MyTestSoftware\Testvalue">MeinTest</key>
          <key path="Software\MyTestSoftware\Testvalue2" type="REG_DWORD">2</key>
          <key path="Software\MyTestSoftware\DeleteValue" />
          <key path="HKCU\Software\MyTestSoftware\DeleteValue" operation="delete" />
        </hive>-->
      </registry>

    </operations>
  </configurationset>
  

  <!-- 
       The "Default" ConfigurationSet will be used, if no other ConfigurationSet has been specified explicitly 
  -->
  <configurationset id="Default">
    <operations>
      <file source="%Temp%\Default.txt" operation="update" overwrite="true">
        <writeline>Just write some sample text.</writeline>
      </file>
    </operations>
  </configurationset>
  

  <!--
       Some samples to demonstrate usage in real-life scenarios
  -->
  <configurationset id="Samples">
    <operations>
      <!-- Allow users to install drivers for the printers/scanners on Windows 7 64 Bit -->
      <registry>
        <rules>
          <include condition="all">
            <rule property="OSVersion" operator="equals" value="Win7Client" />
            <rule property="Architecture" operator="equals" value="X64" />
          </include>
        </rules>
        <!-- Allow Devices Classes-->
        <key path="HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\DriverInstall\Restrictions\AllowUserDeviceClasses" operation="update" type="REG_DWORD">00000001</key>
        <key path="HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\DriverInstall\Restrictions\AllowUserDeviceClasses\1" operation="update" type="REG_SZ">{6BDD1FC6-810F-11D0-BEC7-08002BE2092F}</key>
        <key path="HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\DriverInstall\Restrictions\AllowUserDeviceClasses\2" operation="update" type="REG_SZ">{48721B56-6795-11D2-B1A8-0080C72E74A2}</key>
        <key path="HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\DriverInstall\Restrictions\AllowUserDeviceClasses\3" operation="update" type="REG_SZ">{49CE6AC8-6F86-11D2-B1E5-0080C72E74A2}</key>
        <key path="HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\DriverInstall\Restrictions\AllowUserDeviceClasses\4" operation="update" type="REG_SZ">{4658EE7E-F050-11D1-B6BD-00C04FA372A7}</key>
        <key path="HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\DriverInstall\Restrictions\AllowUserDeviceClasses\5" operation="update" type="REG_SZ">{4D36E971-E325-11CE-BFC1-08002BE10318}</key>
        <key path="HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\DriverInstall\Restrictions\AllowUserDeviceClasses\6" operation="update" type="REG_SZ">{4D36E979-E325-11CE-BFC1-08002BE10318}</key>

        <!-- Switch off PointAndPrint restriction -->
        <key path="HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT\Printers\PointAndPrint\Restricted" operation="update" type="REG_DWORD">00000000</key>
        <key path="HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT\Printers\PointAndPrint\InForest" operation="update" type="REG_DWORD">00000000</key>
        <key path="HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT\Printers\PointAndPrint\TrustedServers" operation="update" type="REG_DWORD">00000000</key>
      </registry>

      <registry>
        <key path="HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SystemInformation\BIOSVersion" operation="read" property="BIOSVersion" />
      </registry>
      
      
      <!-- "Tattoo" some deployment information to the registry -->
      <registry>
        <rules>
          <exclude condition="any">
            <!-- tatoo only in the full OS -->
            <rule property="OSVersion" operator="equals" value="WinPE" />
          </exclude>
        </rules>
        <key path="HKLM\Software\Microsoft\Deployment 4\Deployment Method" operation="update" type="REG_SZ">%DeploymentMethod%</key>
        <key path="HKLM\Software\Microsoft\Deployment 4\Deployment Type" operation="update" type="REG_SZ">%DeploymentType%</key>
        <key path="HKLM\Software\Microsoft\Deployment 4\Build Version" operation="update" type="REG_SZ">%DeploymentMethod%</key>
        <key path="HKLM\Software\Microsoft\Deployment 4\Task Sequence ID" operation="update" type="REG_SZ">%TaskSequenceID%</key>
        <key path="HKLM\Software\Microsoft\Deployment 4\Task Sequence Name" operation="update" type="REG_SZ">%TaskSequenceName%</key>
        <key path="HKLM\Software\Microsoft\Deployment 4\Task Sequence Version" operation="update" type="REG_SZ">%TaskSequenceVersion%</key>
        <key path="HKLM\Software\Microsoft\Deployment 4\Demo" operation="update" type="REG_SZ">#Left("%OSVersion%",3)#</key>
      </registry>
      <registry>
        <rules>
          <exclude condition="any">
            <!-- tatoo only in the full OS -->
            <rule property="OSVersion" operator="equals" value="WinPE" />
          </exclude>
          <include condition="all">
            <rule property="_SMSTSPackageID" operator="notempty" />
          </include>
        </rules>
        <key path="HKLM\Software\Microsoft\Deployment 4\OSD Package ID" operation="update" type="REG_SZ">%_SMSTSPackageID%</key>
        <key path="HKLM\Software\Microsoft\Deployment 4\OSD Program Name" operation="update" type="REG_SZ">*</key>
        <key path="HKLM\Software\Microsoft\Deployment 4\OSD Advertisement ID" operation="update" type="REG_SZ">%_SMSTSAdvertID%</key>
      </registry>


      <!-- Disable Desktop Cleanup in default User profile -->
      <registry>
        <hive source="%USERPROFILE%\..\Default User\NTUSER.DAT">
          <key path="Software\Microsoft\Windows\CurrentVersion\Explorer\Desktop\CleanupWiz\NoRun" operation="update" type="REG_DWORD">1</key>
        </hive>
      </registry>
     
      <!-- Disable Adobe Flash player auto update. Creates the mms.cfg depending on the current architecture. -->
      <file source="%SystemRoot%\System32\Macromed\Flash\mms.cfg" operation="update" overwrite="true">
        <rules>
          <include condition="all">
            <rule property="Architecture" operator="equals" value="X86" />
          </include>
        </rules>
        <writeline>AutoUpdateDisable=1</writeline>
        <writeline>AutoUpdateInterval=0</writeline>
      </file>

      <file source="%SystemRoot%\SysWOW64\Macromed\Flash\mms.cfg" operation="update" overwrite="true">
        <rules>
          <include condition="all">
            <rule property="Architecture" operator="equals" value="X64" />
          </include>
        </rules>
        <writeline>AutoUpdateDisable=1</writeline>
        <writeline>AutoUpdateInterval=0</writeline>
      </file>


      <!-- Updates the unattend.xml file for an offline domain join-->
      <file source="%Temp%\unattend.xml" operation="update" type="xml">
        <rules>
          <include>
            <rule property="OfflineDomainJoinBlob" operator="notempty" />
          </include>>
        </rules>
        <node operation="delete">
          <xpath><![CDATA[//settings[@pass="specialize"]/component[@name="Microsoft-Windows-UnattendedJoin"]/Identification]]></xpath>
        </node>
        <node operation="create">
          <xpath><![CDATA[//settings[@pass="specialize"]/component[@name="Microsoft-Windows-UnattendedJoin"]]]></xpath>
          <node position="child">
            <Identification>
              <Provisioning>
                <AccountData>%OfflineDomainJoinBlob%</AccountData>
              </Provisioning>
            </Identification>
          </node>
        </node>
      </file>
    </operations>
  </configurationset>
</configurationsets>
